-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new lint: suspicious_doc_comments #10497
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @dswij (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
☔ The latest upstream changes (presumably #10481) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! and welcome to Clippy.
Some minor comments and suggestions.
Also, not sure if I personally love the name outer_doc_comment_bang
, but combined with the allow
attribute, it looks neat. I don't know if there is a better name for it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, not sure if I personally love the name outer_doc_comment_bang, but combined with the allow attribute, it looks neat. I don't know if there is a better name for it though.
I agree, I had a hard time coming up with a name for this lint. It seems like the linked issue that initially suggested this lint actually has a name suggestion (suspicious_doc_comment
), totally missed that. I like that one. I'd be fine with renaming this to suspicious_doc_comment
.
Oops, I didn't mean to start a new review there 😅. The comment I left was in response to changing it from "merging" the spans together to linting the lines individually. |
I changed it to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint looks good! Just a couple small question/comment, and it'd be good to merge aftewards.
I think suspicious_doc_comments
is nice because we have other similarly-named lints. Also note that the name would be plural because of Clippy's lint naming convention
This error seems to be common which makes this a very useful lint From the search, there's a few styles that would be good to add as tests Both of these would be joined doc comments but in the first the intention would be to have two separate comments still https://github.com/Twinklebear/tray_rust/blob/9359cb1868a723431214c9fa1fc8c1aef54adae3/src/sampler/morton.rs#L1-L4 Various gaps https://github.com/massalabs/massa/blob/b27e8416efac19e8ec470e96bb49c74687092ac3/massa-async-pool/src/changes.rs#L14-L16
It would also be good to see if it works on items that don't generally have doc comments applied to them, like ///! a
use x;
///! b
macro_rules! x {() => {}} You don't have to explicitly handle all of these, particularly the first two are kind of conflicting, but it'd be good to have tests for them anyway |
This is one of the "known-but-deliberately-ignored" problems, I think, so I don't think I can add a test for this, can I? |
You can put them in a separate |
Re the label: is there something left to do? I think I have a test for all the cases that were mentioned |
@y21 oh, there's a conflict, so I thought you are still working on it :) |
8966407
to
32e9d4b
Compare
Fixed the conflicts and cleaned up the commit history a bit. |
☔ The latest upstream changes (presumably #10601) made this pull request unmergeable. Please resolve the merge conflicts. |
32e9d4b
to
5d01e6e
Compare
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #10485.
This PR adds a new lint (
suspicious_doc_comments
) that triggers when the user writes///!
or/**!
.This is almost certainly a mistake and the user probably meant to write an inner doc comment (
//!
,/*!
) to document the module or crate that this comment is contained in.changelog: [
suspicious_doc_comments
]: new lint